package cc.magicjson.p6spy.repository;

import cc.magicjson.p6spy.entity.User;  // 确保这里使用的是 entity 包
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface UserRepository extends JpaRepository<User, Long> {
    @Query(value = "SELECT * FROM users u WHERE u.name LIKE %?1% OR u.email LIKE %?1%", nativeQuery = true)
    List<User> findByNameOrEmailContaining(String keyword);
}
